package com.shop2cn.iapi.agentproducts.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.activitymgt.parameter.AddactivityBean;
import com.shop2cn.iapi.activitymgt.service.endactivityCall;
import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.ProductListDto;
import com.shop2cn.iapi.agentproducts.parameter.RemoveSpecialActivityProductsBean;
import com.shop2cn.iapi.agentproducts.service.RemoveSpecialActivityProductsCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.AddAgentProductCallService;
import com.ymttest.business.service.AgentProductCallServiceV2;
/**
*活动结束移除所有特卖活动代理商品MQ回调Test
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_RemoveSpecialActivityProducts{
	private static RemoveSpecialActivityProductsBean removespecialactivityproductsBean;
	private static RemoveSpecialActivityProductsCall removespecialactivityproductsCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("活动结束移除所有特卖活动代理商品MQ回调Test");
	}

	@Before
	public void caseUp() {
		removespecialactivityproductsBean=new RemoveSpecialActivityProductsBean();
		removespecialactivityproductsCall=new RemoveSpecialActivityProductsCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(removespecialactivityproductsCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_RemoveSpecialActivityProducts_001() {
		Logger.start(true,"正确数据，成功");
		try {
			int rootUserId = 501428441;
			int agentUserId = 501428443;
			
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"", true);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			//创建限时抢活动
			AddactivityBean initProductaddactivity = AgentProductCallServiceV2.initAgenttActivity(rootUserId, productId,1,30);
			Integer activityId = AgentProductCallServiceV2.agentProductaddactivity(initProductaddactivity);
			AgentProductCallServiceV2.ImportProductByActivityId(agentUserId, activityId);
			List<ProductListDto> getProductLists = AddAgentProductCallService.GetProductLists(agentUserId);
			
			Thread.sleep(3000);
			AgentProductCallServiceV2.endactivity(rootUserId, activityId);
			
			getProductLists = AddAgentProductCallService.GetProductLists(agentUserId);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}